﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace MemoBoss
{
    public partial class PopupDialog : UserControl
    {
        public PopupDialog()
        {
            InitializeComponent();
        }
        Action<bool> Callback;
        //public PopupDialog(Action<bool> callback)
        //    : this()
        //{

        //    Callback = callback;
        //}
        bool DefaultResult;
        public PopupDialog(Action<bool> callback, string text, string btn1Text, string btn2Text, bool defaultResult)
            : this()
        {
            PopupText.Text = text;
            btn1.Content = btn1Text;
            btn2.Content = btn2Text;
            DefaultResult = defaultResult;
            Callback = callback;
        }

        public bool ReturnDefault()
        {
            Callback(DefaultResult);
            return DefaultResult;
        }

        private void btn2_Click(object sender, RoutedEventArgs e)
        {
            Callback(false);
        }

        private void btn1_Click(object sender, RoutedEventArgs e)
        {
            Callback(true);
        }


    }
}
